﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmlEngine.Extensions
{
    public static class ArrayExtensions
    {
        /// <summary>
        /// Searches an array for a given object.
        /// </summary>
        /// <param name="array">The array to search.</param>
        /// <param name="query">The object to search for.</param>
        /// <returns>Whether or not the query is in the array.</returns>
        public static bool Search(this Array array, object query)
        {
            foreach (Object o in array)
            {
                if (o == query) return true;
                else if (array is int[] && (int)o == (int)query) return true;
            }
            return false;
        }
    }
}
